package pers.xuyong.strive.datastruct.order.factory;

import pers.xuyong.strive.datastruct.order.Order;
import pers.xuyong.strive.datastruct.order.sample.BubbleOrder;
import pers.xuyong.strive.datastruct.order.sample.InsertOrder;
import pers.xuyong.strive.datastruct.order.sample.SelectorOrder;

/**
 * 排序工厂
 *
 * @author billymac
 * @version 1.0
 * @date 17/5/23  下午2:52
 * @since JDK1.8
 */
public class OrderFactory {

    /**
     * 获得排序实体
     *
     * @param name
     * @return
     */
    public static Order getOrder(String name) {
        Order order = null;
        if("selectorOrder".equals(name))
            order = new SelectorOrder();
        else if("bubbleOrder".equals(name))
            order = new BubbleOrder();
        else if ("insertOrder".equals(name))
            order = new InsertOrder();
        return order;
    }
}
